const {request,server} = require("../../utils/request");

Page({
  data:{
    imageURL:'https://img01.yzcdn.cn/vant/ipad.jpeg',
    arr:[],
    server
  },
  async onAdd(e){
    let index = e.currentTarget.dataset.index;
    const goods = this.data.arr[index];
    const {uid} =  wx.getStorageSync("userinfo");
    const params = {
      ...goods,
      uid
    }
    console.log(params);
    const r = await request({
      url: '/api/car',
      method:'put',
      data:params
    })
    console.log(r);
  },
  async onShow(){
    const r = await request({
      url: '/api/goodslist'
    })
    this.setData({
      arr:r.list
    })
  }
})